<template>
  <view class="gridList">
    <view class="grid-box">
      <u-grid :col="4" :border="false">
        <u-grid-item v-for="(item, index) in gridItem" :key="item.id">
          <!-- <u-icon name="photo" :size="46"></u-icon> -->
          <image :src="getImgFullPath(item.icon)" class="badge-icon"></image>
          <view class="grid-text">{{ item.name }}</view>
        </u-grid-item>
      </u-grid>
    </view>
  </view>
</template>

<script setup lang="ts">
import { computed, reactive, ref } from 'vue'
import {
  onReady,
  onShow,
  onLoad,
  onReachBottom,
  onPageScroll,
  onShareAppMessage,
  onPullDownRefresh
} from '@dcloudio/uni-app'
//API
import { baseApi } from '@/api'
//工具
import { getImgFullPath } from '@/utils'

// 初始化数据
const gridItem = ref()
const modelType = ref<any>(uni.getStorageSync('selfServiceModelType'))

// 获取枚举列表
const enumList = async () => {
  const { data } = await baseApi.getBASE_DictEnum({
    parentValue: 'sys_question_dict',
    noPaging: true,
    integralsRuleId: modelType.value
  })
  console.log(data, 'data枚举')
  if (data && data.length > 0) {
    gridItem.value = data
  } else {
    gridItem.value = []
  }
}

onLoad(() => {
  enumList()
})
</script>

<style lang="scss" scoped>
.gridList {
  padding: 20rpx;
  height: 100vh;
  background-color: #fff;
}
.badge-icon {
  width: 80rpx;
  height: 80rpx;
}
</style>
